#pragma once
#include "ConstructiveSolidGeometry.h"
class CSphere :
	public CConstructiveSolidGeometry
{
public:
	CSphere(void);
	virtual ~CSphere(void);

	void Init(const CVector3D& vPosition, DATA_TYPE fRadius, const CColor4& vColor, const CMaterial& material);

	virtual bool IsIntersect(const CRay& vRay, DATA_TYPE& t, bool& bInside, CVector3D& vNormal) const;
	virtual bool IsInGeometry(const CVector3D& vPoint) const;
	virtual bool GetAllIntersectionPoints(const CRay& vRay, vector<IntersectionPoint>& vIntersectionPoints) const;

	DATA_TYPE GetRadius() const { return m_fRadius; }

	virtual DATA_TYPE GetMaxValue(int iAxis) const;
	virtual DATA_TYPE GetMinValue(int iAxis) const;

protected:
	CVector3D GetNormal(const CVector3D& vPoint) const;

	DATA_TYPE m_fRadius;
};

typedef boost::shared_ptr<CSphere> CSpherePtr;